home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / MP / kernel_switch / README < prev    next >
Encoding:
Text File  |  1994-08-02  |  3.0 KB  |  88 lines

  1.  
  2.                ~4Dgifts/src/exampleCode/MP/kernel_switch README
  3.  
  4.  
  5.     This directory contains an example that shows how to combine mips1 
  6.     and mips2 objects into a single mips1 and mips2 runnable executable
  7.     through a jump table implementation.  
  8.  
  9.     The idea of the jump table is to eliminate the necessity for 
  10.     maintaining multiple source trees and binaries for different
  11.     SGI instruction set architectures, while most features of the 
  12.     distinct instruction sets can still be exploited.  Basically, the 
  13.     bulk of a code is compiled with the -mips1 flag, but a selected few 
  14.     time consuming modules are duplicated and compiled twice with both 
  15.     the mips1 and the mips2 flags.  Jump table entries of these modules 
  16.     are then added to an include file, and the correct version of the 
  17.     modules will be selected during run time based on an environment
  18.     variable setting.  The magic number of the executable is changed
  19.     to mips1 so that it can run on both mips1 and mips2 systems.
  20.     Please read the small-case lines in main.f and the jump table related 
  21.     assembler, C, and include files in this directory to know more about
  22.     the jump table implementation.  
  23.     
  24.     
  25.     To test the example:
  26.  
  27.         1) make clobber
  28.         2) make 
  29.         3) setenv SGI_ISA mips1 (or mips2)
  30.         4) ./run < ./input
  31.  
  32.  
  33.     To add a new entry in the jump table:
  34.  
  35.         1) make two copies of the source routine of the new 
  36.            entry, say foo.
  37.         2) name one copy foo_mips1 and the other foo_mips2.
  38.         3) add the following line to jmpsyms.h
  39.  
  40.             JMPTAB_ENTRY(foo,_mips1,_mips2)
  41.     
  42.         4) by default foo returns an integer as defined in jmptab.h.
  43.            change the include file if foo returns floating points.
  44.            no change is necessary if foo returns void.
  45.            
  46.  
  47.     Example: (on a crimson running 4.0.5)
  48.  
  49. smith 51# setenv SGI_ISA mips1
  50. smith 52# !./
  51. ./run < input
  52.  MA,NA,MB,NB,MC,NC,IDUMP =          200         200         200         200
  53.           200         200           1
  54.  
  55.  
  56. * CPU TIME FOR OUTER PRODUCT =   1.000000    
  57.   WALL TIME FOR OUTER PRODUCT =  0.8900000    
  58.  MEGAFLOPS =   17.97753    
  59. smith 53# setenv SGI_ISA mips2
  60. smith 54# !./
  61. ./run < input
  62.  MA,NA,MB,NB,MC,NC,IDUMP =          200         200         200         200
  63.           200         200           1
  64.  
  65.  
  66. * CPU TIME FOR OUTER PRODUCT =   1.000000    
  67.   WALL TIME FOR OUTER PRODUCT =  0.8300000    
  68.  MEGAFLOPS =   19.27711    
  69.  
  70.  
  71.     This example shows a jump table implementation of a simple matrix
  72.     multiple of double precision real arrays.  The matrix multiply
  73.     routine is duplicated and compiled with both -mips1 and -mips2,
  74.     and a jump table entry is added.  The test results on a mips2-based
  75.     machine indicate that the program runs ~8 percent better when
  76.     the mips2 kernel is selected.  The mips1 kernel would be the only
  77.     choice if the executable is run on a mips1 machine.
  78.  
  79.  
  80.     Disclaimer:
  81.  
  82.     1) A jump table implementation may result in noticable performance
  83.     degradation due to the jump table overhead and the use of -mips1
  84.     for the majority of the code. 
  85.  
  86.     2) The jump table example works on IRIX 4.0.5 and earilier, or
  87.     any COFF-based SGI environment.  
  88.